package com.mangguo.tingjian.user.mapper;

import com.mangguo.tingjian.user.dto.CountResult;
import com.mangguo.tingjian.user.entity.DwUserRegisterMini;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 注册用户-小程序 Mapper 接口
 * </p>
 *
 * @author auto
 * @since 2019-11-25
 */
@Mapper
public interface DwUserRegisterMiniMapper extends BaseMapper<DwUserRegisterMini> {
    @Select("select count(DISTINCT imei) as count,mYear,mMonth from dw_user_register_mini group by mYear,mMonth")
    List<CountResult> countUniqueImeiByMonth();

    @Select("select count(DISTINCT imei) as count,mDate from dw_user_register_mini where mdate >= #{start} and mdate <= #{end} group by mDate")
    List<CountResult>  countUniqueImeiByDate(@Param("start")Integer start,
                                             @Param("end") Integer end);
}
